<template>
  <!-- 列表 -->
  <ContentWrap>
    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
      <!--      <el-table-column label="ID" align="center" prop="id" />-->
      <!--       <el-table-column label="平台ID" align="center" prop="wid" />-->
      <el-table-column label="上级WID" align="center" prop="topWid" />
      <el-table-column label="上级手机" align="center" prop="topPhone" />
      <el-table-column label="上级名字" align="center" prop="topName" />
      <!--      <el-table-column label="一级" align="center" prop="bindOneWid" />-->
      <!--      <el-table-column label="一级手机" align="center" prop="bindOnePhone" />-->
      <!--      <el-table-column label="二级" align="center" prop="bindTwoWid" />-->
      <!--      <el-table-column label="二级手机" align="center" prop="bindTwoPhone" />-->
      <el-table-column
        label="创建时间"
        align="center"
        prop="createTime"
        :formatter="dateFormatter"
        width="180px"
      />
    </el-table>
  </ContentWrap>
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import { MemberApi } from '@/api/wo/member'

const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗

const props = defineProps<{
  memberId?: number // 会员ID（主表的关联字段）
}>()
const loading = ref(false) // 列表的加载中
const list = ref([]) // 列表的数据

/** 查询列表 */
const getList = async () => {
  loading.value = true
  try {
    const data = await MemberApi.getMemberTeamByMemberId(props.memberId)
    if (!data) {
      return
    }
    list.value.push(data)
  } finally {
    loading.value = false
  }
}

/** 搜索按钮操作 */
const handleQuery = () => {
  queryParams.pageNo = 1
  getList()
}

/** 初始化 **/
onMounted(() => {
  getList()
})
</script>
